//
//  BaseViewController.swift
//  AlgorithmDEMO
//
//  Created by meitianhui2 on 2018/1/13.
//  Copyright © 2018年 DeLongYang. All rights reserved.
//

import UIKit

class BaseViewController: UIViewController {
    
    public var control:BaseControl?
    
    init(control:BaseControl) {
       
        self.control = control
        // ？？ 为啥 super.init() 这个方法报错 Must call a designated initializer of the superclass 'UIViewController'
        super.init(nibName: nil, bundle: nil)
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white
        // 执行相关的算法 在子线程里执行  这里我们开启三个线程 
        DispatchQueue.global().async {
            self.control?.executeAlgorithm()
        }
        
        DispatchQueue.global().async {
            self.control?.executeAlgorithmTwo()
        }
        
        DispatchQueue.global().async {
            self.control?.executeAlgorithmThree()
        }
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

}
